#define _CRT_SECURE_NO_WARNINGS 1
#include "FileUtil.hpp"
#include "DataManager.hpp"
#include "Backup.hpp"

using std::cout;
using std::endl;
using std::string;
using std::vector;

const string data_file = "BackupData.txt";
const string back_dir = ".\\backdir";


void test_FileUtil()
{
	string cur_dir(".\\");
	Cloude::FileUtil fc(cur_dir);
	Cloude::FileUtil fb(back_dir);
	fb.CreateDirectorY();
	vector<string> filenames;
	fc.ScanDirectory(&filenames);
	for (auto& filename : filenames)
		cout << filename << endl;
}

void test_stringstream()
{
	string str = "a.txt a.txt-213124\nb.txt b.txt-2311224\nc.txt ";
	std::stringstream  ss(str);
	string key;
	string val;
	while (ss >> key)
	{
		if (!(ss >> val))
			break;
		cout << key << " " << val << endl;
	}
}

void test_DataManager()
{
	Cloude::DataManager _d(data_file);
	_d.Print();
	string cur_dir(".\\");
	Cloude::FileUtil fc(cur_dir);
	vector<string> filenames;
	fc.ScanDirectory(&filenames);
	for (auto& filename : filenames)
	{
		_d.Insert(filename, "adsfasfd");
	}

}
void test_Backup()
{
	Cloude::Backup bp(data_file, back_dir);
}

void test()
{
	//test_FileUtil();
	//test_stringstream();
	//test_DataManager();
	//test_Backup();
}

int main()
{
	Cloude::Backup(data_file, back_dir).RunMoudle();
	return 0;
}